﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>电商大数据管理平台</title>
		<link rel="icon" href="icon.ico">
		<link rel="stylesheet" href="plugins/bootstrap/css/bootstrap.css">
		<link rel="stylesheet" href="css/dashboard.css">
		<link rel="stylesheet" type="text/css" href="plugins/element-ui/theme-default/index.css" />
		<link rel="stylesheet" href="js/umeditor1.2.3-utf8-jsp/themes/default/css/umeditor.css" />
		<!--[if lt IE 9]>
    <script src="plugins/html5shiv/html5shiv.min.js"></script>
    <script src="plugins/respond/respond.min.js"></script>
    <![endif]-->
	</head>

	<body>
		<div id="app">
			<nav class="navbar navbar-default navbar-fixed-top">
				<div class="container-fluid">
					<div class="navbar-header">
						<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
						<a class="navbar-brand" href="#" style="font-size: x-large;"><strong><b>电商大数据管理平台</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </strong></a>
					</div>
					<navbars :acv='bnav'></navbars>
				</div>
			</nav>

			<div class="container-fluid">
				<div class="row" id="show">
					<datanav :ds="newdpot"></datanav>
					<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
						<h2 style="color: #0D81F5;"><b>季度分析报告</b></h2>
						<div class="placeholders alert alert-info" style="padding-top: 10px;padding-bottom: 10px;">
							<!--<span>区域选择：</span>-->
							<!--<el-select v-model="value" placeholder="市级" style="width:110px;">
                                <el-option v-for="item in options" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                            <el-select v-model="value2" placeholder="区县" style="width:110px;">
                                <el-option v-for="item in options2" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
							<!--<span>时间选择：</span>
                            <el-select v-model="value3" placeholder="年度" style="width:110px;">
                                <el-option v-for="item in options3" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>

                            <el-select v-model="value4" placeholder="季度" style="width:110px;">
                                <el-option v-for="item in options4" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>-->
							<button class="btn btn-default" type="button" onclick="stamp()" value="打印报告">打印预览</button>
						</div>
						<div style="margin-right: auto; margin-left: auto; max-width: 970px;">
							<h2 class="sub-header text-center"><span class="report-title"></span></h2>
							<div style="margin-bottom:40px;">
								<p class="text-muted">分析报告从本季度总体情况、平台、产品、主体等几个方面统计分析，给出图文模板，可以修改并保存最终生成的报告。</p>
								<script id="container1" style="width:100%;" name="content" type="text/plain" name="content"></script>
							</div>
							<button class="btn btn-lg btn-info btn-block" onclick="stamp()">保存并生成报告预览</button>
						</div>
					</div>

				</div>

				<div id="dayin" style="padding-top: 100px;padding-bottom: 100px;display:none;">
					<p align="center">
						<button class="btn btn-info" type="button" onclick="stamps()" value="打印报告">打印报告</button>
						<button class="btn btn-default" type="button" onclick="stampss()" value="打印报告">取消</button>
					</p>
					<div id="dayins" class="container">
						<h2 style="text-align:center" class="sub-header text-center"><span class="report-title"></span></h2>
						<p style="margin-bottom:40px">
							<p>
								<div id="cont1"></div>
							</p>
							</br>
					</div>
				</div>
			</div>
		</div>

		<div style="padding-top: 150px" class="modal fade" id="chartshow" tabindex="-1" data-backdrop="static" role="dialog" aria-labelledby="selectCateModalLabel" aria-hidden="true">
			<div class="modal-dialog" style="width:980px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title">插入图表</h4>
					</div>
					<div class="modal-body" style="width:980px;">
						<div id="main1" style="height:550px;width:940px;margin:auto;"></div>
					</div>
					<div class="modal-footer">
						<button type="button" id="chartclose" class="btn btn-primary">确认</button>
					</div>
				</div>
			</div>
		</div>

		<div style="padding-top: 150px" class="modal fade" id="maininfomodal" tabindex="-1" data-backdrop="static" role="dialog" aria-labelledby="selectInfoModalLabel" aria-hidden="true">
			<div class="modal-dialog" style="width:980px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title">总体情况</h4>
					</div>
					<div class="modal-body" style="width:980px;">
						<div id="maininfo" style="width:940px;margin:auto;"></div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>

		<script src="plugins/jquery/jquery.min.js"></script>
		<script src="plugins/bootstrap/js/bootstrap.min.js"></script>
		<script src="js/ie10-viewport-bug-workaround.js"></script>
		<script type="text/javascript" src="js/vue.min.js"></script>
		<script type="text/javascript" src="js/nav.js"></script>
		<script src="plugins/element-ui/index.js"></script>

		<script type="text/javascript" src="js/echarts.min.js"></script>
		<script src="js/echarts/theme/diy.js"></script>

		<!--<script src="umeditor1.2.3-utf8-jsp/third-party/jquery.min.js"></script>-->
		<script src="js/umeditor1.2.3-utf8-jsp/third-party/template.min.js"></script>
		<script src="js/umeditor1.2.3-utf8-jsp/umeditor.config.js"></script>
		<script src="js/umeditor1.2.3-utf8-jsp/umeditor.js"></script>
		<script src="js/umeditor1.2.3-utf8-jsp/lang/zh-cn/zh-cn.js"></script>

		<!--<script src="js/ueditor-1.4.3.3/ueditor.config.js"></script>
    <script src="js/ueditor-1.4.3.3/ueditor.all.js"></script>-->
		<script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js"></script>
		<script src="js/common.js"></script>

		<!-- plupload -->
		<script src="js/plupload/crypto.js"></script>
		<script src="js/plupload/hmac.js"></script>
		<script src="js/plupload/sha1.js"></script>
		<script src="js/plupload/base64.js"></script>
		<script src="js/plupload/plupload.full.min.js"></script>
		<script src="js/plupload/upload.js"></script>

		<script>
			//模板
			var txt =
				'<p><strong  class="pid" style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">一、总体情况</strong>\
    </p><p><p class="t0"></p><p><br/></p>\
    <img src="" style="width:100%" class="t1"><p><br/></p>\
    <img src="" style="width:100%" class="t2"><p><br/></p>\
    <img src="" style="width:100%" class="t3"><p><br/></p>\
    </p><p>\
    <strong style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;"><br/></strong>\
    </p><p>\
    <strong style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;"></strong></p>\
    <p style="margin-top: 0px; margin-bottom: 10px; font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif;line-height: 22.8571px; white-space: normal;">\
    <strong>二、独立分析</strong>\
    </p>\
    <p style="margin-top: 0px; margin-bottom: 10px; font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">\
    <b>（一）平台</b> </p><p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;1、平台交易情况</b></p>\
    <img src="" style="width:100%" class="t4-0-0"><p><br/></p>\
    <img src="" style="width:100%" class="t4-0-1"><p><br/></p>\
    <img src="" style="width:100%" class="t4-0-2"><p><br/></p>\
    <img src="" style="width:100%" class="t4-0-3"><p><br/></p>\
    <img src="" style="width:100%" class="t4-1"><p><br/></p>\
    <img src="" style="width:100%" class="t4-2"><p><br/></p>\
    <img src="" style="width:100%" class="t4-3"><p><br/></p>\
    <img src="" style="width:100%" class="t4-4"><p><br/></p>\
    <img src="" style="width:100%" class="t4-5"><p><br/></p>\
    <img src="" style="width:100%" class="t4-6"><p><br/></p>\
    <img src="" style="width:100%" class="t4-7"><p><br/></p>\
    <img src="" style="width:100%" class="t4-8"><p><br/></p>\
    <img src="" style="width:100%" class="t4-9"><p><br/></p>\
    <img src="" style="width:100%" class="t4-10"><p><br/></p>\
    <img src="" style="width:100%" class="t4-11"><p><br/></p>\
    <img src="" style="width:100%" class="t4-12"><p><br/></p></p>\
    <p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;2、平台数量</b></p>\
    <img src="" style="width:100%" class="t12"><p><br/></p>\
    <p>\
    <strong style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;"><br/></strong>\
    </p>\
    <p>\
        <span style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">（二）产品</span><strong style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;"><br/></strong><br/>\
        </p><p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;1、产品TOP10</b></p>\
        <img src="" style="width:100%" class="t6-1"><p><br/></p>\
        <img src="" style="width:100%" class="t6-2"><p><br/></p>\
        <img src="" style="width:100%" class="t6-3"><p><br/></p>\
        </p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;2、连续三月TOP10店铺</b></p>\
        <p><img src="" style="width:100%" class="t10"><p><br/></p>\
				</p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;3、TOP10店铺交易情况</b></p>\
				<p><img src="" style="width:100%" class="t9-1"><p><br/></p>\
        <p><img src="" style="width:100%" class="t9-2"><p><br/></p>\
        <p><img src="" style="width:100%" class="t9-3"><p><br/></p>\
        </p><p><b>&nbsp;&nbsp;&nbsp;&nbsp;4、店铺TOP100占比</b></p>\
        <p><img src="" style="width:100%" class="t7-1"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-2"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-3"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-4"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-5"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-6"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-7"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-8"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-9"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-10"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-11"><p><br/></p>\
        <p><img src="" style="width:100%" class="t7-12"><p><br/></p>\
    <p>\
        <span style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">（三）主体</span>\
    </p>\
    		<p><img src="" style="width:100%" class="t8"></p>\
    		<p><img src="" style="width:100%" class="t11"><p><br/></p>\
    <p>\
        <span style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;"><br/></span>\
    </p>\
    <p >\
        <span style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">\<strong style="font-family: &#39;microsoft yahei&#39;, simsun, helvetica, arial, sans-serif; line-height: 22.8571px; white-space: normal;">三、工作建议</strong></span>\
        <p>&nbsp; &nbsp;&nbsp;&nbsp;</p>\
        <p>&nbsp; &nbsp;&nbsp;&nbsp;</p>\
    </p>'

			//数据报告对象
			var dataTemplate = {
				"id": "",
				"generalSituation": "", //总体情况
				"platformStatistics": "", //平台统计
				"productAnalysis": "", //产品分析
				"subjectAnalysis": "", //主体分析
				"workProposal": "", //工作建议
				"quarter": "" //季度
			};

			var dataObj = dataTemplate;
			var ue1;
			var mstxt2;
			var mstxt;
			var chartdata = {
				xdata: ['碧江区', '大龙经济开发区', '德江县', '江口县', '思南县', '松桃县'],
				sname: "平台数量",
				lname: "贸易数量",
				sdata: [5020, 4900, 4523, 3600, 2003, 1600],
				ldata: [5020, 4900, 4523, 3600, 2003, 1600],
			}
			var datayears = GetQueryString("years");
			var datayquarter = GetQueryString("quarter");

			var reportTitle = '铜仁市';
			reportTitle += (!datayears) ? "" : (datayears + "年");
			reportTitle += (!datayquarter) ? "" : ("第" + datayquarter + "季度");
			reportTitle += "电子商务发展分析报告";

			$(document).ready(function() {
				"use strict";
				$('.report-title').text(reportTitle);
				var obj1 = document.getElementById("dayin");
				dataObj.quarter = GetQueryString('years') + "-" + GetQueryString('quarter'); //季度
				ueEditorInit();
				obj1.style.display = "none";
				loadDataReport(); //加载当前季度的数据报告
			});

			var ajaxchart = {
				chart0: function(type) {
					$.ajax({
						url: '/ebb/collectivity/all?year=' + datayears + '&quarter=' + datayquarter,
						type: 'get',
						success: function(result) {

							var colAll = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;自平台上线以来，截止' +
								datayears + '年' + datayquarter * 3 + '月底，全市共计：' +
								'电商平台 ' + result.ebbPlatformTotal +
								' 个，其中第三方 ' + result.thirdPartyPlatform + '个';

							var threeRst = '';
							$.ajax({
								url: '/ebb/electricityBusiness/statistics/threePlatform?year=' + datayears + '&quarter=' + datayquarter,
								type: 'get',
								success: function(rst) {
									threeRst += ' （没有交易额的店铺数量 ' + rst.noExistingAmount +
										' 个，有交易额的店铺数量 ' + rst.existingAmount +
										' 个，有交易额的店铺的平均交易额' + rst.averageTurnover + '元）';
								},
								complete: function() {
									colAll += threeRst;
									colAll += '，自建平台 ' + result.selfBuiltPlatform +
										' 个、电商综合服务站点 ' + result.comServicePlatform +
										' 个；物流网点 ' + result.logisticsNetworkNode +
										' 个（其中发入量 ' + result.logisticsMonthIn +
										' 件，发出量 ' + result.logisticsMonthOut +
										' 件）；电商培训批次 ' + result.trainBatch +
										' 次，共培训' + result.trainPeopleNum +
										'人；通过电商平台销售的产品约' + result.productNum + '个。';
									if(type) {
										mstxt2.find('.t0').html(colAll);
										ue1.setContent(mstxt2.html());
									}else {
										$('#maininfo').html(colAll);
										$('#maininfomodal').modal('show');
									}
								}
							});
						}
					});
				},
				chart1: function() {
					var myobj = {
						title: '电商总体分析报告\n',
						xdata: [],
						sname: "数量",
						lname: "",
						sdata: [],
						ldata: [],
						legend: ["数量"]
					};
					var datas = {};
					$.ajax({
						url: '/ebb/collectivity/all?year=' + datayears + '&quarter=' + datayquarter,
						type: 'get',
						success: function(result) {
							datas = result;
							for(var i in datas) {
								if(datas.hasOwnProperty(i)) {
									var name = filterKeyName(i);
									myobj.xdata.push(name);
									myobj.sdata.push(datas[i]);
								}
							}
							var imgurl = makechart(myobj);
							mstxt2.find('.t1').attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart2: function() {
					var myobj = {
						title: '各类电商平台交易情况\n',
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/collectivity/ebbAnalysisByType?year=' + datayears + '&quarter=' +
							datayquarter,
						type: 'get',
						success: function(result) {
							datas = result;
							datas.sort(rank('tradingVolume', false));
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(datas[i].type)
								myobj.sdata.push(datas[i].businessVolume)
								myobj.ldata.push(datas[i].tradingVolume)
							}
							var imgurl = makechart(myobj);
							mstxt2.find('.t2').attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart3: function() {
					var myobj = {
						title: "电商平台第" + datayquarter + "季度每月交易情况\n",
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/collectivity/ebbMonthAndQuarterDataAnalysis?year=' + datayears +
							'&quarter=' + datayquarter,
						type: 'get',
						success: function(result) {
							datas = result;
							datas.sort(rank('tradingVolume', false));
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(datas[i].type)
								myobj.sdata.push(datas[i].businessVolume)
								myobj.ldata.push(datas[i].tradingVolume)
							}
							var imgurl = makechart(myobj);
							mstxt2.find('.t3').attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart4: function(addresscode, tt, tittle) {
					var tl = tittle + datayears + "年";
					var month = '';
					var yearAndMonth = '';
					var type = false;
					if(tt == ".t4-0-1") {
						month = datayears + ((datayquarter >= 4) ? '-' : '-0') + (datayquarter * 3 - 2);
						tl += (datayquarter * 3 - 2) + "月";
					} else if(tt == ".t4-0-2") {
						month = datayears + ((datayquarter >= 4) ? '-' : '-0') + (datayquarter * 3 - 1);
						tl += (datayquarter * 3 - 1) + "月";
					} else if(tt == ".t4-0-3") {
						month = datayears + ((datayquarter >= 4) ? '-' : '-0') + (datayquarter * 3);
						tl += (datayquarter * 3) + "月";
					} else {
						tl += "第" + datayquarter + "季度";
						if(tt != ".t4-0-0") {
							type = true;
						}
					}
					var myobj = {
						title: tl + "各类电商平台交易情况\n",
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/electricityBusiness/statistics/?year=' + datayears + '&quarter=' +
							datayquarter + '&addressCode=' + addresscode + '&yearAndMonth=' + month,
						type: 'get',
						success: function(result) {
							datas = result;
							datas.sort(rank('tradingVolume', type));
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(datas[i].platformCategory)
								myobj.sdata.push(parseInt(datas[i].businessVolume))
								myobj.ldata.push(parseInt(datas[i].tradingVolume))
							}
							var	imgurl = type ? makechart(myobj): makechart3(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart5: function(addresscode, tt, tittle) {
					var myobj = {
						title: tittle + "各类电商平台数量\n",
						xdata: [],
						sname: "数量",
						lname: "",
						sdata: [],
						ldata: [],
						legend: ["平台数量"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/electricityBusiness/statistics/platform/?year=' + datayears +
							'&quarter=' + datayquarter + '&addressCode=' + addresscode,
						type: 'get',
						success: function(result) {
							datas = result;
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(datas[i].platformCategory + "(第" + datas[i].type +
									"类型)")
								myobj.sdata.push(datas[i].count)
							}
							var imgurl = makechart(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart6: function(month, tt) {
					var myobj = {
						title: month + '产品TOP10交易情况\n',
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/data/report/product/top/?year=' + datayears + '&quarter=' + datayquarter +
							'&topType=10',
						type: 'get',
						success: function(result) {
							datas = result[month];
							datas.sort(rank('tradingVolume', false));
							for(var i = 0; i < datas.length; i++) {
								var nameStyle = (datas[i].productName&&datas[i].productName.length>8)? (datas[i].productName.substring(0,8)+'\n' + datas[i].productName.substring(8,datas[i].productName.length)) : datas[i].productName;
								myobj.xdata.push(nameStyle)
								myobj.sdata.push(parseInt(datas[i].businessVolume))
								myobj.ldata.push(parseInt(datas[i].tradingVolume))
							}
							var imgurl = makechart3(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart7: function(topType, area, tt) {
					var myobj = {
						title: area + "所有店铺TOP" + topType + "占比分析\n",
						xdata: [],
						yname: "占比/%",
						ydata: [],
						legend: ["占比百分比（%)"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/data/report/ebb/top/rate/?year=' + datayears + '&quarter=' +
							datayquarter + '&topType=' + topType,
						type: 'get',
						success: function(result) {
							datas = result[area];
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(parseInt(datas[i].month) + "月")
								myobj.ydata.push(parseFloat(datas[i].rate))
							}
							var imgurl = makechart5(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart8: function(tt) {
					var myobj = {
						title: '各区县培训统计分析',
						xdata: [],
						sname: "培训总人数（人）",
						lname: "培训次数（次）",
						sdata: [],
						ldata: [],
						legend: ["培训总人数", "培训次数"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/data/report/train/?year=' + datayears + '&quarter=' + datayquarter,
						type: 'get',
						success: function(result) {
							datas = result;
							for(var i = 0; i < datas.geoCodeList.length; i++) {
								myobj.xdata.push(datas.geoCodeList[i].geoName)
								myobj.sdata.push(datas.trainInfoCountDtos[i].trainPeoplesTotal)
								myobj.ldata.push(datas.trainInfoCountDtos[i].trainInfoCount)
							}
							var imgurl = makechart(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart9: function(yearAndMonth, tt) {
					var myobj = {
						title: '铜仁市' + yearAndMonth + '店铺TOP10',
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/data/report/ebb/top/?year=' + datayears + '&quarter=' + datayquarter +
							'&topType=10',
						type: 'get',
						success: function(result) {
							datas = result[yearAndMonth];
							datas.sort(rank('tradingVolume', false));
							for(var i = 0; i < datas.length; i++) {
								var name = datas[i].storeName;
								name = (name&&name.length>8) ? (name.substring(0,8)+'\n' + name.substring(8,name.length)) : name;
								myobj.xdata.push(name);
								myobj.sdata.push(parseInt(datas[i].businessVolume));
								myobj.ldata.push(parseInt(datas[i].tradingVolume));
							}
							var imgurl = makechart3(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart10: function(tt) {
					var myobj = {
						title: '铜仁市第' + datayquarter + '季度连续三月销量在TOP10榜单的店铺分析',
						xdata: [],
						sname: "交易量（件）",
						lname: "交易额（元）",
						sdata: [],
						ldata: [],
						legend: ["交易量（件）", "交易额（元）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/data/report/ebb/continuity/top/?year=' + datayears + '&quarter=' + datayquarter + '&topType=10',
						//url: 'mock/continuityTop.json',
						type: 'get',
						success: function(result) {
							var dataSerial = [];
							var dataBusiness = [];
							var dataTrading = [];
							var n = 0;
							for(var i in result) {
								if(n == 0) {
									for(var j = 0; j < result[i].length; j++) {
										var name = result[i][j].storeName;
										name = (name&&name.length>8) ? (name.substring(0,8)+'\n' + name.substring(8,name.length)) : name;
										dataSerial.push(name);
										dataBusiness.push(parseInt(parseFloat(result[i][j].businessVolume)));
										dataTrading.push(parseInt(parseFloat(result[i][j].tradingVolume)));
									}
								} else {
									for(var j = 0; j < result[i].length; j++) {
										dataBusiness[j] += parseInt(parseFloat(result[i][j].businessVolume));
										dataTrading[j] += parseInt(parseFloat(result[i][j].tradingVolume));
									}
								}
								n++;
							}
							myobj.xdata = dataSerial;
							myobj.sdata = dataBusiness;
							myobj.ldata = dataTrading;
							var imgurl = makechart3(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart11: function(tt) {
					var myobj = {
						title: '铜仁市第' + datayquarter + '季度各区县物流业务分析',
						xdata: [],
						sname: "发出量（件）",
						lname: "发入量（件）",
						sdata: [],
						ldata: [],
						legend: ["发出量（件）", "发入量（件）"]
					};
					var datas = [];
					$.ajax({
						url: '/ebb/front/logistics/analysis/business',
						type: 'get',
						success: function(result) {
							datas = result;
							datas.sort(rank('monthOutAmount', false));
							for(var i = 0; i < datas.length; i++) {
								myobj.xdata.push(datas[i].geoName)
								myobj.sdata.push(parseInt(datas[i].monthInAmount))
								myobj.ldata.push(parseInt(datas[i].monthOutAmount))
							}
							var imgurl = makechart3(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				},
				chart12: function(tt) {
					var myobj = {
						title: '各区县第三方平台/自建平台/电商站点数量分析',
						xdata: [],
						series1: [],
						series2: [],
						series3: [],
						legend: ['第三方平台', '自建平台', '电商综合站点']
					};
					var datas = [];
					$.ajax({
						url: '/ebb/electricityBusiness/statistics/platform/?group=address_code,type',
						//url: 'mock/platformType.json',
						type: 'get',
						success: function(result) {
							datas = result;
							var areaArr = ['碧江区', '万山区','印江土家族苗族自治县','大龙经济开发区','德江县','思南县','松桃苗族自治县','江口县','沿河土家族自治县','玉屏侗族自治县','石阡县','高新区']
							var type1 = [0,0,0,0,0,0,0,0,0,0,0,0];
							var type2 = [0,0,0,0,0,0,0,0,0,0,0,0];
							var type3 = [0,0,0,0,0,0,0,0,0,0,0,0];
							for(var i = 0; i < datas.length; i++) {
								for(var j = 0; j < areaArr.length; j++) {
									if(datas[i].addressDetail == areaArr[j]) {
										if(datas[i].type == 1) {
											type1[j] += datas[i].count;
										}else if(datas[i].type == 2){
											type2[j] += datas[i].count;
										}else {
											type3[j] += datas[i].count;
										}
									}
								}
							}
							myobj.xdata = areaArr;
							myobj.series1 = type1;
							myobj.series2 = type2;
							myobj.series3 = type3;
							//var imgurl = makechart2(myobj);
							var imgurl = makechart4(myobj);
							mstxt2.find(tt).attr('src', imgurl);
							ue1.setContent(mstxt2.html());
						}
					});
				}
			}

			//坚直柱状单轴
			function makechart5(chartdatas) {
				var imgbase64 = "";
				var option = {
					tooltip: {
						trigger: 'axis'
					},
					title: {
						text: chartdatas.title,
						x: 'center'
					},
					legend: {
						data: chartdatas.legend,
						y: '30'
					},
					grid: {
						y: '80',
						y2: '100'
					},
					xAxis: [{
						type: 'category',
						data: chartdatas.xdata,
						axisLabel: {
							interval: 0,
							rotate: 20 //-30度角倾斜显示
						},
						axisTick: {
							alignWithLabel: true
						}
					}],
					yAxis: [{
						type: 'value',
						name: chartdatas.yname,
						axisLabel: {
							formatter: '{value} '
						}
					}],
					series: [{
						name: chartdatas.yname,
						type: 'bar',
						data: chartdatas.ydata,
						barMaxWidth: 100,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}]
				};
				var myChart = echarts.init(document.getElementById('main1'), 'diy');
				myChart.setOption(option);

				imgbase64 = myChart.getDataURL("png");

				return imgbase64
			}

			//坚直柱状双轴
			function makechart(chartdatas) {
				var imgbase64 = "";
				var option = {
					tooltip: {
						trigger: 'axis'
					},
					title: {
						text: chartdatas.title,
						x: 'center'
					},
					legend: {
						data: chartdatas.legend,
						y: '30'
					},
					grid: {
						y: '80',
						y2: '100'
					},
					xAxis: [{
						type: 'category',
						data: chartdatas.xdata,
						axisLabel: {
							interval: 0,
							rotate: 20 //-30度角倾斜显示
						},
						axisTick: {
							alignWithLabel: true
						}
					}],
					yAxis: [{
						type: 'value',
						name: chartdatas.sname,
						axisLabel: {
							formatter: '{value} '
						}
					}, {
						type: 'value',
						name: chartdatas.lname,
						axisLabel: {
							formatter: '{value} '
						}
					}],
					series: [{
						name: chartdatas.legend[0],
						type: 'bar',
						data: chartdatas.sdata,
						barMaxWidth: 100,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}, {
						name: chartdatas.legend[1],
						type: 'bar',
						data: chartdatas.ldata,
						barMaxWidth: 100,
						yAxisIndex: 1,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}]
				};
				var myChart = echarts.init(document.getElementById('main1'), 'diy');
				myChart.setOption(option);

				imgbase64 = myChart.getDataURL("png");

				return imgbase64
			}

			//堆叠水平柱状双轴
			function makechart2(chartdatas) {
				var option = {
					title: {
						text: chartdatas.title,
						x: 'center'
					},
					tooltip: {
						trigger: 'axis',
						axisPointer: { // 坐标轴指示器，坐标轴触发有效
							type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
						}
					},
					legend: {
						data: chartdatas.legend,
						y: '30'
					},
					toolbox: {
						show: false
					},
					grid: {
						x: '100'
					},
					calculable: true,
					yAxis: [{
						type: 'category',
						data: chartdatas.xdata,
						axisLabel: {
							interval: 0,
							rotate: 20, //-30度角倾斜显示
							formatter: function(value, index) {
								if(value&&value.length>8) {
									return value.substring(0,8) + '\n' + value.substring(8,value.length);
								}else {
									return value;
								}
							}
						},
						axisTick: {
							alignWithLabel: true
						}
					}],
					xAxis: [{
						type: 'value'
					}],
					series: [{
							name: chartdatas.legend[0],
							type: 'bar',
							stack: '总量',
							itemStyle: {
								normal: {
									label: {
										show: true,
										position: 'insideRight'
									}
								}
							},
							data: chartdatas.series1
						},
						{
							name: chartdatas.legend[1],
							type: 'bar',
							stack: '总量',
							itemStyle: {
								normal: {
									label: {
										show: true,
										position: 'insideLeft'
									}
								}
							},
							data: chartdatas.series2
						},
						{
							name: chartdatas.legend[2],
							type: 'bar',
							stack: '总量',
							itemStyle: {
								normal: {
									label: {
										show: true,
										position: 'insideRight'
									}
								}
							},
							data: chartdatas.series3
						}
					]
				};

				var myChart = echarts.init(document.getElementById('main1'), 'diy');
				myChart.setOption(option);
				imgbase64 = myChart.getDataURL("png");
				return imgbase64
			}

			//水平柱状双轴
			function makechart3(chartdatas) {
				var imgbase64 = "";
				var option = {
					tooltip: {
						trigger: 'axis'
					},
					title: {
						text: chartdatas.title,
						x: 'center'
					},
					legend: {
						data: chartdatas.legend,
						y: '30'
					},
					grid: {
						x: '100',
					},
					yAxis: [{
						type: 'category',
						data: chartdatas.xdata,
						axisLabel: {
							interval: 0,
							rotate: 20 //-30度角倾斜显示
						},
						axisTick: {
							alignWithLabel: true
						}
					}],
					xAxis: [{
						type: 'value',
						name: chartdatas.sname,
						axisLabel: {
							formatter: '{value} '
						}
					}, {
						type: 'value',
						name: chartdatas.lname,
						axisLabel: {
							formatter: '{value} '
						}
					}],
					series: [{
						name: chartdatas.sname,
						type: 'bar',
						data: chartdatas.sdata,
						label: {
							normal: {
								show: true,
								position: 'right',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}, {
						name: chartdatas.lname,
						type: 'bar',
						data: chartdatas.ldata,
						label: {
							normal: {
								show: true,
								position: 'right',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}]
				};
				var myChart = echarts.init(document.getElementById('main1'), 'diy');
				myChart.setOption(option);

				imgbase64 = myChart.getDataURL("png");

				return imgbase64
			}

			//竖直三组数据单轴
			function makechart4(chartdatas) {
				var imgbase64 = "";
				var option = {
					tooltip: {
						trigger: 'axis'
					},
					title: {
						text: chartdatas.title,
						x: 'center'
					},
					legend: {
						data: chartdatas.legend,
						y: '30'
					},
					grid: {
						y: '80',
						y2: '100'
					},
					xAxis: [{
						type: 'category',
						data: chartdatas.xdata,
						axisLabel: {
							interval: 0,
							rotate: 20 //-30度角倾斜显示
						},
						axisTick: {
							alignWithLabel: true
						}
					}],
					yAxis: [{
						type: 'value',
					}, {
						type: 'value',
					}, {
						type: 'value',
					}],
					series: [{
						name: chartdatas.legend[0],
						type: 'bar',
						data: chartdatas.series1,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}, {
						name: chartdatas.legend[1],
						type: 'bar',
						data: chartdatas.series2,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}, {
						name: chartdatas.legend[2],
						type: 'bar',
						data: chartdatas.series3,
						label: {
							normal: {
								show: true,
								position: 'top',
								textStyle: {
									color: '#323232',
									fontSize: 14
								}
							}
						},
					}]
				};
				var myChart = echarts.init(document.getElementById('main1'), 'diy');
				myChart.setOption(option);

				imgbase64 = myChart.getDataURL("png");

				return imgbase64
			}

			function allchartshow() {
				ajaxchart.chart1();
				ajaxchart.chart2();
				ajaxchart.chart3();

				ajaxchart.chart4('520600000000', '.t4-0-0', '铜仁市');
				ajaxchart.chart4('520600000000', '.t4-0-1', '铜仁市');
				ajaxchart.chart4('520600000000', '.t4-0-2', '铜仁市');
				ajaxchart.chart4('520600000000', '.t4-0-3', '铜仁市');

				ajaxchart.chart4('520602000000', '.t4-1', '碧江区');
				ajaxchart.chart4('520603000000', '.t4-2', '万山区');
				ajaxchart.chart4('520625000000', '.t4-3', '印江土家族苗族自治县');
				ajaxchart.chart4('520605000000', '.t4-4', '大龙经济开发区');
				ajaxchart.chart4('520626000000', '.t4-5', '德江县');
				ajaxchart.chart4('520624000000', '.t4-6', '思南县');
				ajaxchart.chart4('520628000000', '.t4-7', '松桃苗族自治县');
				ajaxchart.chart4('520621000000', '.t4-8', '江口县');
				ajaxchart.chart4('520627000000', '.t4-9', '沿河土家族自治县');
				ajaxchart.chart4('520622000000', '.t4-10', '玉屏侗族自治县');
				ajaxchart.chart4('520623000000', '.t4-11', '石阡县');
				ajaxchart.chart4('520604000000', '.t4-12', '高新区');

				// ajaxchart.chart5('520602000000', '.t5-1', '碧江区');
				// ajaxchart.chart5('520603000000', '.t5-2', '万山区');
				// ajaxchart.chart5('520625000000', '.t5-3', '印江土家族苗族自治县');
				// ajaxchart.chart5('520605000000', '.t5-4', '大龙经济开发区');
				// ajaxchart.chart5('520626000000', '.t5-5', '德江县');
				// ajaxchart.chart5('520624000000', '.t5-5', '思南县');
				// ajaxchart.chart5('520628000000', '.t5-6', '松桃苗族自治县');
				// ajaxchart.chart5('520621000000', '.t5-8', '江口县');
				// ajaxchart.chart5('520627000000', '.t5-9', '沿河土家族自治县');
				// ajaxchart.chart5('520622000000', '.t5-10', '玉屏侗族自治县');
				// ajaxchart.chart5('520623000000', '.t5-11', '石阡县');
				// ajaxchart.chart5('520604000000', '.t5-12', '高新区');

				ajaxchart.chart6('2017-01', '.t6-1');
				ajaxchart.chart6('2017-02', '.t6-2');
				ajaxchart.chart6('2017-03', '.t6-3');

				ajaxchart.chart7(100, '碧江区', '.t7-1');
				ajaxchart.chart7(100, '万山区', '.t7-2');
				ajaxchart.chart7(100, '印江土家族苗族自治县', '.t7-3');
				ajaxchart.chart7(100, '大龙经济开发区', '.t7-4');
				ajaxchart.chart7(100, '德江县', '.t7-5');
				ajaxchart.chart7(100, '思南县', '.t7-6');
				ajaxchart.chart7(100, '松桃苗族自治县', '.t7-7');
				ajaxchart.chart7(100, '江口县', '.t7-8');
				ajaxchart.chart7(100, '沿河土家族自治县', '.t7-9');
				ajaxchart.chart7(100, '玉屏侗族自治县', '.t7-10');
				ajaxchart.chart7(100, '石阡县', '.t7-11');
				ajaxchart.chart7(100, '高新区', '.t7-12');

				ajaxchart.chart8('.t8');

				ajaxchart.chart9('2017-01', '.t9-1');
				ajaxchart.chart9('2017-02', '.t9-2');
				ajaxchart.chart9('2017-03', '.t9-3');

				ajaxchart.chart10('.t10');
				ajaxchart.chart11('.t11');
				ajaxchart.chart12('.t12');
			}

			function filterKeyName(key) {
				switch(key) {
					case "ebbPlatformTotal":
						return "电商平台总数";
						break;
					case "comServicePlatform":
						return "电商站点数";
						break;
					case "logisticsNetworkNode":
						return "物流网点数";
						break;
					case "logisticsMonthIn":
						return "物流发入量";
						break;
					case "logisticsMonthOut":
						return "物流发出量";
						break;
					case "trainBatch":
						return "培训批次";
						break;
					case "trainPeopleNum":
						return "培训人数";
						break;
					case "productNum":
						return "电商平台销售产品数";
						break;
					case "thirdPartyPlatform":
						return "第三方平台数量";
						break;
					case "selfBuiltPlatform":
						return "自建平台数量";
						break;
					default:
						return "";
						break;
				}
			}

			//百度编辑器
			function ueEditorInit() {
				window.UMEDITOR_CONFIG.toolbar = [
					// 加入一个 myinput
					' source | undo redo | bold italic underline strikethrough  forecolor backcolor | removeformat |',
					'| justifyleft justifycenter justifyright justifyjustify |',
					'link unlink | emotion image video | map',
					'| fullscreen | maininfo'
				];
				window.UMEDITOR_CONFIG.topOffset = 60;

				UM.registerUI('maininfo', function (name) {
					var me = this;
					var $btn = $.eduibutton({
						icon: name,
						click: function () {
							ajaxchart.chart0(false);
						},
						title: '总体情况'
					});
					this.addListener('selectionchange', function () { //切换为不可编辑时，把自己变灰
						var state = this.queryCommandState(name);
						$btn.edui().disabled(state == -1).active(state == 1)
					});
					return $btn;
				});

				ue1 = UM.getEditor('container1');
				ue1.ready(function() {
					ue1.setContent(txt);
				});

			}

			function rank(prop, desc) {
				return function (obj1, obj2) {
					var val1 = obj1[prop];
					var val2 = obj2[prop];
					if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
						val1 = Number(val1);
						val2 = Number(val2);
					}
					return (desc) ? ((val1 < val2) ? 1 : -1) : ((val1 > val2) ? 1 : -1);
				};
			}
		</script>
		<script>
			function stamp() {
				//获取数据报告的内容
				var sText = ue1.getContent();
				document.getElementById("cont1").innerHTML = sText;

				sText = '<div class="mybody">' + sText + '</div>'
				var sText1 = $(sText);
				sText1.find('img').attr('src', '');
				//设置数据报告对象
				dataObj.generalSituation = sText1.html();

				//保存数据报告
				saveDataReport();

				var obj = document.getElementById("show");
				obj.style.display = "none";
				var obj1 = document.getElementById("dayin");
				obj1.style.display = "block";
			}

			function stamps() {
				var newstr = document.getElementById("dayins").innerHTML;
				var oldstr = document.body.innerHTML; //保存原先网页的代码
				document.body.innerHTML = newstr; //将网页内容更改成需要打印
				window.print();
				document.body.innerHTML = oldstr;
			}

			function stampss() {
				var obj = document.getElementById("show");
				obj.style.display = "block";
				var obj1 = document.getElementById("dayin");
				obj1.style.display = "none";
			}
			//查询数据报告
			function loadDataReport() {
				$.ajax({
					url: '/ebb/datareport/',
					type: 'get',
					data: {
						'index': 1,
						'size': 10,
						'quarter': dataObj.quarter
					},
					success: function(result) {
						//设置数据报告对象
						dataObj = result.data.length > 0 ? result.data[0] : dataTemplate;
						//总体情况
						if(result.data.length > 0 && result.data[0].generalSituation && result.data[0].generalSituation.length > 0 && result.data[0].generalSituation != "<p><br></p>") {
							ue1.setContent(dataObj.generalSituation);
						} else {
							ajaxchart.chart0(true);
						}
						mstxt = ue1.getContent();
						mstxt = '<div class="mybody">' + mstxt + '</div>'
						mstxt2 = $(mstxt);

						allchartshow();

					}
				});
			}
			//保存数据报告
			function saveDataReport() {
				if(!dataObj.id) { //如果ID为空，新增
					$.ajax({
						url: '/ebb/datareport/',
						type: 'post',
						data: JSON.stringify(dataObj),
						contentType: "application/json",
						success: function(result) {
							console.log("报表生成成功！");
						}
					});
				} else { //否则，更新
					$.ajax({
						url: '/ebb/datareport/',
						type: 'put',
						data: JSON.stringify(dataObj),
						contentType: "application/json",
						success: function(result) {
							console.log("报表生成成功！");
						}
					});
				}

			}
			new Vue({
				el: "#app",
				data: {
					bnav: {
						number: 4,
					},
					newdpot: GetQueryString('years') + "第" + GetQueryString('quarter') + "季度",
					options: [{
						value: '1',
						label: '图表1'
					}, {
						value: '2',
						label: '图表2'
					}, {
						value: '3',
						label: '图表3'
					}, {
						value: '4',
						label: '图表4'
					}, {
						value: '5',
						label: '图表5'
					}, {
						value: '6',
						label: '图表6'
					}, {
						value: '7',
						label: '图表7'
					}, {
						value: '8',
						label: '图表8'
					}, {
						value: '9',
						label: '图表9'
					}, {
						value: '10',
						label: '图表10'
					}],
					options3: [{
						value: '2017',
						label: '2017'
					}, {
						value: '2016',
						label: '2016'
					}],
					options4: [{
						value: '1',
						label: '第一季度'
					}, {
						value: '2',
						label: '第二季度'
					}, {
						value: '3',
						label: '第三季度'
					}, {
						value: '4',
						label: '第四季度'
					}],
					value: 1,
					value3: '2017',
					value4: '1',
				},
				computed: {},
				mounted: function() {

				},
				methods: {

				},
				watch: {

				}
			});
		</script>
	</body>

</html>